Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow-up bug fixes for _group_measurements #5559

Merged
merged 16 commits into from
Apr 24, 2024
Merged

Follow-up bug fixes for _group_measurements #5559

merged 16 commits into from
Apr 24, 2024

Conversation

astralcai
Copy link
Contributor

@astralcai astralcai commented Apr 23, 2024

Context:
PR #5525 led to two bugs:

  • group_observables uses are_identity_pauli_words, which does not work for legacy Hamiltonian.
  • get_num_shots_and_executions incorrectly counts number of executions for Sum

Description of the Change:

  • Converts single-term Hamiltonian to SProd
  • Use the grouping information of Sum to correctly count number of executions.

Related Shortcut Issues:
[sc-61807]
[sc-61812]
Fixes #5561

Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@astralcai astralcai changed the title Fix bug in group_observables with single-term Hamiltonian Follow-up bug fixes for _group_measurements Apr 23, 2024
@astralcai astralcai marked this pull request as ready for review April 23, 2024 18:38
@astralcai astralcai added this to the v0.36 milestone Apr 23, 2024
@astralcai astralcai requested a review from lillian542 April 23, 2024 19:14
Copy link

codecov bot commented Apr 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.68%. Comparing base (f504341) to head (3174ef7).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5559      +/-   ##
==========================================
- Coverage   99.69%   99.68%   -0.01%     
==========================================
  Files         410      410              
  Lines       38235    37987     -248     
==========================================
- Hits        38118    37869     -249     
- Misses        117      118       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@lillian542 lillian542 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

pennylane/devices/qubit/sampling.py Outdated Show resolved Hide resolved
Copy link
Contributor

@PietropaoloFrisoni PietropaoloFrisoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems flawless to me!

@astralcai astralcai enabled auto-merge (squash) April 24, 2024 20:43
@astralcai astralcai merged commit 9151477 into master Apr 24, 2024
38 checks passed
@astralcai astralcai deleted the group-meas-bug branch April 24, 2024 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Grouping is not automatically used in qnode execution (or tracker is wrong)
3 participants